<!DOCTYPE html>
<html lang="">
<head>
	<meta charset="utf-8">
	<title>Retina Dashboard</title>
	<meta name="description" content="" />
	<meta name="keywords" content="" />
	<meta name="robots" content="" />
	<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
	<link rel="stylesheet" href="/static/css/style.css" media="all" />

    <script src="http://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <script src="/static/js/jquery.wysiwyg.js"></script>
    <script src="/static/js/jquery.checkbox.min.js"></script>

    <script src="/static/js/jquery.tablesorter.min.js"></script>
    <!--<script src="http://Code.highcharts.com/highcharts.js"></script>-->
    <!--<script src="jquery-1.11.2.js"></script>-->

</head>
<body>
    <div class="testing">
<header class="main">
	<h1><strong>Retina</strong> Dashboard</h1>
	<!--<input type="text" value="search" />-->
</header>
<section class="user">
	<div class="profile-img">
		<img src="/static/images/uiface2.png" alt="" height="40" width="40" /> Welcome back John Doe
	</div>
	<div class="buttons">
		<span class="button blue"><a href="/admin/login_out/{{.tel}}">登出</a></span>
	</div>
</section>
</div>
    <nav>
	<ul>
        <li><a href="/admin/index/{{.tel}}"><span class="icon">&#128711;</span> 设备监控</a></li>
        <li><a href="/admin/admin_list/{{.tel}}"><span class="icon">&#128101;</span>管理员<span class="pip">3</span></a></li>
        <li>
            <a href="/admin/sys_setting/{{.tel}}"><span class="icon">&#9881;</span>系统设置</a>
        </li>
        <li class="section">
            <a href="/admin/show_remote_list/{{.tel}}"><span class="icon">&#9881;</span>显示遥控数据</a>
        </li>
        <li>
            <a href="/admin/add_remote_data/{{.tel}}"><span class="icon">&#9881;</span>添加遥控数据</a>
        </li>
	</ul>
</nav>


    <section class="topcontent">
	<section class="widget">
		<header>
			<span class="icon">&#128200;</span>
			<hgroup>
				<h1>基本信息</h1>
			</hgroup>
			<aside>
				<button id="submit_btn" type="button">更新</button>
			</aside>
		</header>	
<!--<section class="widget0"></section>-->
        <section class="widget1">
            <div class="user0">
<br>
<div id="form_title">用户空调数据</div>
<br>
<table border="1">
<tr>
    <td>
        <center>
            <div class="input_tag">遥控器的名字</div>
        </center>
    </td>
    <td><input type="text" class=text id="RemoteName"></td>
    <td><pre>                                        </pre></td>
    <td>
        <center>
            <div class="input_tag">编号</div>
        </center>
    </td>
    <td><input type="text" class=text id="NO"></td>
</tr>
<tr>
    <td>
        <center>
            <div class="input_tag">版本号</div>
        </center>
    </td>
    <td>
        <input type="text" class=text id="Version">
    </td>
    <td><pre>                                        </pre></td>
    <td>
        <center><div class="input_tag">设备型号</div></center>
    </td>
    <td>
        <input type="text" class=text id="DeviceType">
    </td>
</tr>
<!--<tr>-->
    <!--<td>-->
        <!--<center>-->
            <!--<div class="input_tag">无效位</div>-->
        <!--</center>-->
    <!--</td>-->
    <!--<td>-->
        <!--<input type="text" class=text id="SaveUrl">-->
    <!--</td>-->
    <!--<td></td>-->
    <!--<td><center><div class="input_tag">上传的用户ID</div></center></td>-->
    <!--<td><input type="text" class=text id="User"></td>-->
<!--</tr>-->
<tr>
    <td>
        <center><div class="input_tag">载波频率</div></center>
    </td>
    <td>
        <input type="text" class=text id="IRFRQ">
    </td>
    <td></td>
    <td>
        <center><div class="input_tag">采样脉冲宽度</div></center>
    </td>
    <td><input type="text" class=text id="TimeScale"></td>
</tr>
<tr>
    <td>
        <center>
            <div class="input_tag">关机</div>
        </center>
    </td>
    <td><input type="text" class=text id="PoweroffCode"></td>
    <td></td>
    <td><center><div class="input_tag">开机码字</div></center></td>
    <td><input type="text" class=text id="BootCode"></td>
</tr>

</table>
</div>
                <div class="accode_form_class">
	                <div id="acCode">

                        <table border="1">
                            <tr>
                                    <td>
                                        <center>
                                            <div id="model">模式</div>
                                        </center>
                                    </td>
                                    <td>
                                        <center>
                                            <div class="form_tag">开始的位数</div>
                                        </center>
                                    </td>
                                    <td>
                                        <center>
                                            <div class="form_tag">码值</div>
                                        </center>
                                    </td>
                                    <td>
                                        <center>
                                            <div class="form_tag">位宽</div>
                                        </center>
                                    </td>
                            </tr>
                            <tr>
                                <td>
                                    <center>
                                       <div id="WindAutoModel_TAG">风速自动模式</div>
                                    </center>
                                </td>
                                <div class="WindAutoModel">
                                    <td><center><input type="text" class="WindAutoModel StartAddr"/></center></td>
                                    <td><center><input type="text" class="WindAutoModel Code"/></center></td>
                                    <td><center><input type="text" class="WindAutoModel BitLength"></center></td>
                                </div>
                             </tr>
                            <tr>
                                <td>
                                    <center>
                                        <div id="WindHighModel_TAG">风速高模式</div>
                                    </center>
                                </td>
                                <div class="WindHighModel">
                                    <td><center><input type="text" class="WindHighModel StartAddr"></center></td>
                                    <td><center><input type="text" class="WindHighModel Code"></center></td>
                                    <td><center><input type="text" class="WindHighModel BitLength"></center></td>
                                </div>
                            </tr>
                            <tr>
                                <td>
                                    <center>
                                        <div id="WindMidModel_TAG">风速中模式</div>
                                    </center>
                                </td>
                                <div class="WindMidModel">
                                    <td><center><input type="text" class="WindMidModel StartAddr"></center></td>
                                    <td><center><input type="text" class="WindMidModel Code"></center></td>
                                    <td><center><input type="text" class="WindMidModel BitLength"></center></td>
                                </div>
                            </tr>
                            <tr>
                                <td>
                                    <center>
                                        <div id="WindLowModel_TAG">风速低模式</div>
                                    </center>
                                </td>
                                <div class="WindLowModel">
                                    <td><center><input type="text" class="WindLowModel StartAddr"></center></td>
                                    <td><center><input type="text" class="WindLowModel Code"></center></td>
                                    <td><center><input type="text" class="WindLowModel BitLength"></center></td>
                                </div>
                            </tr>
                            <tr>
                                <td>
                                    <center>
                                        <div id="HotModel_TAG">制热模式</div>
                                    </center>
                                </td>
                                <div class="HotModel">
                                    <td><center><input type="text" class="HotModel StartAddr"></center></td>
                                    <td><center><input type="text" class="HotModel Code"></center></td>
                                    <td><center><input type="text" class="HotModel BitLength"></center></td>
                                </div>
                            </tr>
                             <tr>
                                <td>
                                    <center>
                                        <div id="CodeModel_TAG">制冷模式</div>
                                    </center>
                                </td>
                                <div class="CodeModel">
                                    <td><center><input type="text" class="CodeModel StartAddr"></center></td>
                                    <td><center><input type="text" class="CodeModel Code"></center></td>
                                    <td><center><input type="text" class="CodeModel BitLength"></center></td>
                                </div>
                            </tr>
                            <tr>
                                <td>
                                    <center>
                                        <div id="VentilateModel_TAG">通风模式</div>
                                    </center>
                                </td>
                                <div class="VentilateModel">
                                    <td><center><input type="text" class="VentilateModel StartAddr"></center></td>
                                    <td><center><input type="text" class="VentilateModel Code"></center></td>
                                    <td><center><input type="text" class="VentilateModel BitLength"></center></td>
                                </div>
                            </tr>
                            <tr>
                                <td>
                                    <center>
                                        <div id="DehumidifyModel_TAG">除湿模式</div>
                                    </center>
                                </td>
                                <div class="DehumidifyModel">
                                    <td><center><input type="text" class="DehumidifyModel StartAddr"></center></td>
                                    <td><center><input type="text" class="DehumidifyModel Code"></center></td>
                                    <td><center><input type="text" class="DehumidifyModel BitLength"></center></td>
                                </div>
                            </tr>

                            <tr>
                                <td>
                                    <center>
                                        <div id="DefaultCode_TAG">编码模板</div>
                                    </center>
                                </td>
                                <td><center><input type="text" class=text id="DefaultCode"></center></td>
                            </tr>
                        </table>

                    </div>
                </div>

</section>
<!--<section class="widget2"></section>-->
        </section>
    </section>

</body>

<script>
var RemoteData =  {{.RemoteData}}
function GetData(){
        RemoteData.RemoteName=$("#RemoteName").val();
        RemoteData.NO=$("#NO").val();
        RemoteData.Version=$("#Version").val();
        RemoteData.DeviceType=parseInt($("#DeviceType").val());
        //RemoteData.SaveUrl=$("#SaveUrl").val();
        //RemoteData.User=parseInt($("#User").val());
        //RemoteData.UpdateTime=$("#UpdateTime").val();
        RemoteData.TimeScale=parseInt($("#TimeScale").val());
        RemoteData.IRFRQ=parseInt($("#IRFRQ").val());
        RemoteData.BootCode=$("#BootCode").val();
        RemoteData.PoweroffCode=$("#PoweroffCode").val();
        RemoteData.AcCode.WindAutoModel.StartAddr=parseInt($(".WindAutoModel.StartAddr").val());
        RemoteData.AcCode.WindAutoModel.Code=$(".WindAutoModel.Code").val();
        RemoteData.AcCode.WindAutoModel.BitLength=parseInt($(".WindAutoModel.BitLength").val());
        RemoteData.AcCode.WindHighModel.StartAddr=parseInt($(".WindHighModel.StartAddr").val());
        RemoteData.AcCode.WindHighModel.Code=$(".WindHighModel.Code").val();
        RemoteData.AcCode.WindHighModel.BitLength=parseInt($(".WindHighModel.BitLength").val());
        RemoteData.AcCode.WindMidModel.StartAddr=parseInt($(".WindMidModel.StartAddr").val());
        RemoteData.AcCode.WindMidModel.Code=$(".WindMidModel.Code").val();
        RemoteData.AcCode.WindMidModel.BitLength=parseInt($(".WindMidModel.BitLength").val());
        RemoteData.AcCode.WindLowModel.StartAddr=parseInt($(".WindLowModel.StartAddr").val());
        RemoteData.AcCode.WindLowModel.Code=$(".WindLowModel.Code").val();
        RemoteData.AcCode.WindLowModel.BitLength=parseInt($(".WindLowModel.BitLength").val());
        RemoteData.AcCode.HotModel.StartAddr=parseInt($(".HotModel.StartAddr").val());
        RemoteData.AcCode.HotModel.Code=$(".HotModel.Code").val();
        RemoteData.AcCode.HotModel.BitLength=parseInt($(".HotModel.BitLength").val());
        RemoteData.AcCode.CodeModel.StartAddr=parseInt($(".CodeModel.StartAddr").val());
        RemoteData.AcCode.CodeModel.Code=$(".CodeModel.Code").val();
        RemoteData.AcCode.CodeModel.BitLength=parseInt($(".CodeModel.BitLength").val());
        RemoteData.AcCode.VentilateModel.StartAddr=parseInt($(".VentilateModel.StartAddr").val());
        RemoteData.AcCode.VentilateModel.Code=$(".VentilateModel.Code").val();
        RemoteData.AcCode.VentilateModel.BitLength=parseInt($(".VentilateModel.BitLength").val());
        RemoteData.AcCode.DehumidifyModel.StartAddr=parseInt($(".DehumidifyModel.StartAddr").val());
        RemoteData.AcCode.DehumidifyModel.Code=$(".DehumidifyModel.Code").val();
        RemoteData.AcCode.DehumidifyModel.BitLength=parseInt($(".DehumidifyModel.BitLength").val());
        RemoteData.AcCode.DefaultCode=$("#DefaultCode").val();
}
$(document).ready(function(){

    console.log(RemoteData)
    	$("#RemoteName").val(RemoteData.RemoteName);
        $("#NO").val(RemoteData.NO);
        $("#Version").val(RemoteData.Version);
       $("#DeviceType").val(RemoteData.DeviceType);
        $("#SaveUrl").val(RemoteData.SaveUrl);
        //RemoteData.User=parseInt($("#User").val(RemoteData.));
        //RemoteData.UpdateTime=$("#UpdateTime").val(RemoteData.);

        $("#TimeScale").val(RemoteData.TimeScale);
        $("#IRFRQ").val(RemoteData.IRFRQ);
        $("#BootCode").val(RemoteData.BootCode);
        $("#PoweroffCode").val(RemoteData.PoweroffCode);

        $(".WindAutoModel.StartAddr").val(RemoteData.AcCode.WindAutoModel.StartAddr);
        $(".WindAutoModel.Code").val(RemoteData.AcCode.WindAutoModel.Code);
        $(".WindAutoModel.BitLength").val(RemoteData.AcCode.WindAutoModel.BitLength);

        $(".WindHighModel.StartAddr").val(RemoteData.AcCode.WindHighModel.StartAddr);
        $(".WindHighModel.Code").val(RemoteData.AcCode.WindHighModel.Code);
        $(".WindHighModel.BitLength").val(RemoteData.AcCode.WindHighModel.BitLength);

        $(".WindMidModel.StartAddr").val(RemoteData.AcCode.WindMidModel.StartAddr);
        $(".WindMidModel.Code").val(RemoteData.AcCode.WindMidModel.Code);
        $(".WindMidModel.BitLength").val(RemoteData.AcCode.WindMidModel.BitLength);

        $(".WindLowModel.StartAddr").val(RemoteData.AcCode.WindLowModel.StartAddr);
        $(".WindLowModel.Code").val(RemoteData.AcCode.WindLowModel.Code);
        $(".WindLowModel.BitLength").val(RemoteData.AcCode.WindLowModel.BitLength);

        $(".HotModel.StartAddr").val(RemoteData.AcCode.HotModel.StartAddr);
        $(".HotModel.Code").val(RemoteData.AcCode.HotModel.Code);
        $(".HotModel.BitLength").val(RemoteData.AcCode.HotModel.BitLength);

        $(".CodeModel.StartAddr").val(RemoteData.AcCode.CodeModel.StartAddr);
        $(".CodeModel.Code").val(RemoteData.AcCode.CodeModel.Code);
        $(".CodeModel.BitLength").val(RemoteData.AcCode.CodeModel.BitLength);

        $(".VentilateModel.StartAddr").val(RemoteData.AcCode.VentilateModel.StartAddr);
        $(".VentilateModel.Code").val(RemoteData.AcCode.VentilateModel.Code);
        $(".VentilateModel.BitLength").val(RemoteData.AcCode.VentilateModel.BitLength);

        $(".DehumidifyModel.StartAddr").val(RemoteData.AcCode.DehumidifyModel.StartAddr);
        $(".DehumidifyModel.Code").val(RemoteData.AcCode.DehumidifyModel.Code);
        $(".DehumidifyModel.BitLength").val(RemoteData.AcCode.DehumidifyModel.BitLength);
       $("#DefaultCode").val(RemoteData.AcCode.DefaultCode);

       $("#submit_btn").click(function(){
            //alert("dadd");
            GetData();
            console.log(RemoteData)
            $.post('http://'+window.location.host+'/admin/update_remote/'+RemoteData.ObjectId,RemoteData,function(data){
				console.log(data)
				if(data.RespCode == 200){
                    /*$.post('http://'+window.location.host+'/admin/login',{'Tel':tel,'UserPw':pw},function(data){
                        console.log(data)
                    });*/
                    $("#login_form").submit();
                   }else{
                        alert(data.Msg);
                   }
                return false
			});
       });
});
</script>
</html>